<?php

include_once 'controller/default.php';
include_once 'model/tags/process.php';
include_once 'checkForm/xulychuoi.php';

if (isset($_POST)) {
    $tags = new tags();
    if (isset($_POST["accept"])) {
        $insert = $tags->Insert($_POST);
        if ($insert) {
            echo '<script>alert("Thêm Tags thành công.")</script>';
            include 'view/tags/tags_manager.php';
        } else {
            echo '<script>alert("Thêm Tags thất bại.")</script>';
            include 'view/tags/tags_create.php';
        }
    } else if (isset($_POST["update"])) {
        $update = $tags->Update($_POST);
        if ($update) {
            echo '<script>alert("Sửa Tags thành công.")</script>';
            include 'view/tags/tags_manager.php';
        } else {
            echo '<script>alert("Sửa Tags thất bại.")</script>';
            include 'view/tags/tags_update.php';
        }
    }
}
?>
